<?php
class SchemePermissions extends Zend_Db_Table
{
	protected $_name = "schemepermissions";
	
	public function getSchemePermissions()
	{
		$select = $this->_db->select()
							->from(array('schemePerm'=>$this->_name),null)
							->join(array('permissions'=>'permissions'),
										'permissions.id = schemePerm.permission',"name as privilege")
							->join(array('projectRole'=>'projectrole'),
										'projectRole.id = schemePerm.perm_parameter',"name as role")
							->join(array('projectRoleActor'=>'projectroleactor'),
										'projectRoleActor.projectroleid=projectRole.id',null)
							->where("schemePerm.perm_type = 'projectrole'")
							->group("schemePerm.id");
								
		//echo $select;
		$results = $this->getAdapter()->fetchAll($select);
		return $results;
	}
}